package day12;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class HashMapDemo {
    public static void main(String[] args) {
        Map<Integer,String> map=new HashMap<>();
        map.put(1,"java");
        map.put(2,"pyth");
        map.put(3,"oricle");
        map.put(4,"python");
        map.put(null,"null");
        Set<Integer> keySets= map.keySet();
        Iterator<Integer> iter=keySets.iterator();
        while (iter.hasNext()){
            Integer key=iter.next();
            String value=map.get(key);
            System.out.println(key+"-"+value);
        }
        System.out.println(map);

        Set<Map.Entry<Integer,String>> entrySet=map.entrySet();
        Iterator<Map.Entry<Integer,String>> entryIter=entrySet.iterator();
        while (entryIter.hasNext()){
            Map.Entry<Integer,String> entry =entryIter.next();
            System.out.println(entry.getKey()+":"+entry.getValue());

        }


    }
}
